<template>
  <div class="articleList">
    <div class="return clearfix">
      <router-link to="/home"> 首页 </router-link>
      > {{type}}
    </div>
    <ul class="col-md-8 list-group">
      <li v-for="art in arts" class="list-group-item">
        {{art.title}}
      </li>
    </ul>
  </div>
</template>

<style>
  .articleList .list-group .list-group-item {
    border: none;
  }
</style>

<script>
  export default {
    data () {
      return {
        type: '',
        arts: [{
          title: '花儿为什么这样红',
          autor: '记忆',
          type: '1',
          intro: '因为你是sb啊,我去你大爷250你知道蠢猪怎么写么？',
          content: '<p>因为你是sb啊,我去你大爷<strong>250</strong></p><p>你知道蠢猪怎么写么？</p>',
          time: Date.now(),
          good: 0,
          bad: 0,
          collected: 0,
          read: 0,},
          {
          title: '花儿为什么这样红',
          autor: '记忆',
          type: '1',
          intro: '因为你是sb啊,我去你大爷250你知道蠢猪怎么写么？',
          content: '<p>因为你是sb啊,我去你大爷<strong>250</strong></p><p>你知道蠢猪怎么写么？</p>',
          time: Date.now(),
          good: 0,
          bad: 0,
          collected: 0,
          read: 0},
          {
          title: '花儿为什么这样红',
          autor: '记忆',
          type: '1',
          intro: '因为你是sb啊,我去你大爷250你知道蠢猪怎么写么？',
          content: '<p>因为你是sb啊,我去你大爷<strong>250</strong></p><p>你知道蠢猪怎么写么？</p>',
          time: Date.now(),
          good: 0,
          bad: 0,
          collected: 0,
          read: 0},
          {
          title: '花儿为什么这样红',
          autor: '记忆',
          type: '1',
          intro: '因为你是sb啊,我去你大爷250你知道蠢猪怎么写么？',
          content: '<p>因为你是sb啊,我去你大爷<strong>250</strong></p><p>你知道蠢猪怎么写么？</p>',
          time: Date.now(),
          good: 0,
          bad: 0,
          collected: 0,
          read: 0},]
      }
    },
    mounted () {
      var type = this.$route.params.type
      switch (type) {
        case 'better': 
          this.type = '精品文章'
          break
        case 'hot': 
          this.type = '热门排行'
          break
      }
      this.$http.get(this.rootPath + '/all?type=' + type).then((res) => {
        this.arts = res.data
      })
    },
    props: ['rootPath']
  }
</script>